#ifndef _CU_TYPES_H_
#define _CU_TYPES_H_

#include <float.h>
#include "cuAssert.h"

//#ifndef __device__
//#define __device__
//#endif
//
//#ifndef __host__
//#define __host__ 
//#endif

#define SDH_CALL static __device__ __host__   // Static Device Host prefix
#define SH_CALL  static __host__              // Static Host        prefix
#define SD_CALL  static __device__            // Static Device      prefix

typedef unsigned __int64        uint64;
typedef unsigned int            uint32;
typedef unsigned short          uint16;
typedef unsigned char           uint08;
typedef unsigned char           uint8;

typedef unsigned __int64        u64;
typedef unsigned int            u32;
typedef unsigned short          u16;
typedef unsigned char           u08;
typedef unsigned char           u8;

typedef unsigned int            uint;
typedef unsigned short          ushort;
typedef unsigned char           uchar;

typedef   signed __int64        sint64;
typedef   signed int            sint32;
typedef   signed short          sint16;
typedef   signed char           sint08;
typedef   signed char           sint8;

typedef          __int64        int64;
typedef          int            int32;
typedef          short          int16;
typedef          char           int08;
typedef          char           int8;

typedef   signed __int64        i64;
typedef   signed int            i32;
typedef   signed short          i16;
typedef   signed char           i08;
typedef   signed char           i8;

typedef   signed int            sint;
typedef   signed short          sshort;
typedef   signed char           schar;

typedef float                   real32;
typedef double                  real64;

typedef float                   real;

CU_CT_ASSERT(sizeof(bool)==1);
CU_CT_ASSERT(sizeof(i08)==1);
CU_CT_ASSERT(sizeof(u08)==1);
CU_CT_ASSERT(sizeof(i16)==2);
CU_CT_ASSERT(sizeof(u16)==2);
CU_CT_ASSERT(sizeof(i32)==4);
CU_CT_ASSERT(sizeof(u32)==4);
CU_CT_ASSERT(sizeof(i64)==8);
CU_CT_ASSERT(sizeof(u64)==8);

CU_CT_ASSERT(sizeof(void*)==4);

// Type ranges
#define	CU_MAX_I8					0x7f					//max possible sbyte value
#define	CU_MIN_I8					0x80					//min possible sbyte value
#define	CU_MAX_U8					0xff					//max possible ubyte value
#define	CU_MIN_U8					0x00					//min possible ubyte value
#define	CU_MAX_I16				0x7fff				//max possible sword value
#define	CU_MIN_I16				0x8000				//min possible sword value
#define	CU_MAX_U16				0xffff				//max possible uword value
#define	CU_MIN_U16				0x0000				//min possible uword value
#define	CU_MAX_I32				0x7fffffff		//max possible sdword value
#define	CU_MIN_I32				0x80000000		//min possible sdword value
#define	CU_MAX_U32				0xffffffff		//max possible udword value
#define	CU_MIN_U32				0x00000000		//min possible udword value
#define	CU_MAX_F32				FLT_MAX				//max possible float value
#define	CU_MIN_F32				(-FLT_MAX)		//min possible float value
#define	CU_MAX_F64				DBL_MAX				//max possible double value
#define	CU_MIN_F64				(-DBL_MAX)		//min possible double value

#define CU_EPS_F32				FLT_EPSILON		//smallest number not zero
#define CU_EPS_F64				DBL_EPSILON		//smallest number not zero

#define CU_IEEE_1_0				0x3f800000		//integer representation of 1.0
#define CU_IEEE_255_0			0x437f0000		//integer representation of 255.0
#define CU_IEEE_MAX_F32		0x7f7fffff		//integer representation of CU_MAX_F32
#define CU_IEEE_MIN_F32		0xff7fffff		//integer representation of CU_MIN_F32

typedef int	CU_BOOL;
#define CU_FALSE					0
#define CU_TRUE						1

#define	CU_MIN(a, b)			((a) < (b) ? (a) : (b))			//Returns the min value between a and b
#define	CU_MAX(a, b)			((a) > (b) ? (a) : (b))			//Returns the max value between a and b

#define CU_PI             3.14159265358979323846f

#include <vector_types.h>
#include "cuVector.h"

#include "cuMatrix.h"

#endif